/**
 * @author 赵希奥
 * @date 2022/3/17 0:14
 * @gitHub https://github.com/CKXGZXA
 * @gitee https://gitee.com/ckxgzxa
 * @description: 宝马汽车类, 充当原型角色
 */
public class BmwCar implements Cloneable {
    /**
     * 轮胎
     */
    private String tire;
    /**
     * 方向盘
     */
    private String steeringWheel;
    /**
     * 发动机
     */
    private String engine;

    public String getTire() {
        return tire;
    }

    public void setTire(String tire) {
        this.tire = tire;
    }

    public String getSteeringWheel() {
        return steeringWheel;
    }

    public void setSteeringWheel(String steeringWheel) {
        this.steeringWheel = steeringWheel;
    }

    public String getEngine() {
        return engine;
    }

    public void setEngine(String engine) {
        this.engine = engine;
    }


    /**
     * 使用 clone() 方法实现克隆
     */
    @Override
    public BmwCar clone() {
        Object o = null;
        try {
            o = super.clone();
            return (BmwCar) o;
        } catch (CloneNotSupportedException e) {
            System.out.println("不支持复制!");
            return null;
        }
    }

    @Override
    public String toString() {
        String str = "";
        str += ("轮胎 : " + this.getTire() + " | ");
        str += ("发动机 : " + this.getEngine() + " | ");
        str += ("方向盘 : " + this.getSteeringWheel());
        return str;
    }
}
